#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include<stdlib.h>
//typedef char BTDataType;
typedef struct BinaryTreeNode
{
	char _data;
	struct BinaryTreeNode* _left;
	struct BinaryTreeNode* _right;
}BTNode;
BTNode* BinaryTreeCreate(char* a, int* pi)
{
	if (a[*pi] == '#')
	{
		(*pi)++;
		return NULL;
	}
	BTNode* root = (BTNode*)malloc(sizeof(BTNode));
	root->_data = a[(*pi)++];

	root->_left = BinaryTreeCreate(a, pi);

	root->_right = BinaryTreeCreate(a, pi);
	return root;
}
void BinaryTreeInOrder(BTNode* root)
{
	if (root == NULL)
	{
		//printf("N ");
		return;
	}
	BinaryTreeInOrder(root->_left);
	printf("%c ", root->_data);
	BinaryTreeInOrder(root->_right);
}
int main()
{
	char arr[101];
	scanf("%s", arr);
	int i = 0;
	BTNode* root = BinaryTreeCreate(arr, &i);
	BinaryTreeInOrder(root);
	return 0;
}